using System;
using System.Data;
using digit.Core;

namespace SMS.MediaManager
{
	public class VoiceData
	{
		#region CONSTRUCTORS
		public VoiceData( string connectionString)
		{
			this.m_connectionString = connectionString;
		}
		#endregion
		
		#region ATTRIBUTES
		const string SQL_INSERT = "SP_Insert_Voice";
		const string SQL_UPDATE = "SP_Update_Voice";
		const string SQL_DELETE = "SP_Delete_Voice";
		const string SQL_SELECTONE = "SP_Select_Voice";
		const string SQL_SELECTALL = "SP_SelectAll_Voice";
		const string SQL_SEARCH = "SP_Search_Voice";
		private string m_connectionString;
		#endregion
		
		#region METHODS
		public DataTable Insert( object[] values)
		{
            return DataAccess.FillTable(this.m_connectionString, SQL_INSERT, values, true);
		}
		
		public bool Update( object[] values)
		{
			int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, SQL_UPDATE, values);
			return i > 0;
		}
		
		public bool Delete( object[] values)
		{
			int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, SQL_DELETE, values);
			return i > 0;
		}
		
		public DataTable Select( object[] values)
		{
			return DataAccess.FillTable(this.m_connectionString, SQL_SELECTONE, values, true);
		}
		
		public DataTable SelectAll()
		{
			return DataAccess.FillTable(this.m_connectionString, SQL_SELECTALL, true);
		}
		
		public DataTable Search( object[] values,  int startIndex,  int maxRow)
		{
			return DataAccess.FillTableSpecial(this.m_connectionString, SQL_SEARCH, values, true, startIndex, maxRow, "Voice");
		}

        public DataTable SearchBy(object[] values)
        {
            return DataAccess.FillTable(this.m_connectionString, "SP_Select_Voice_By", values, true);
        }

        public bool Approve(object[] values)
        {
            int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, "SP_Approve_Voice", values);
            return i > 0;
        }
		
		#endregion
		
	}
}